gh-140729: Fix the cProfile module when the executed script contains calls to multiprocessing.Process#144715
Open
YvesDup wants to merge 3 commits intopython:mainfrom
Open
gh-140729: Fix the cProfile module when the executed script contains calls to multiprocessing.Process#144715YvesDup wants to merge 3 commits intopython:mainfrom
YvesDup wants to merge 3 commits intopython:mainfrom
Conversation
aisk
reviewed
Feb 12, 2026
| def test_process_run_pickle(self): | ||
| # gh-140729: test use Process in cProfile. | ||
| val = 10 | ||
| test_script = f''' |
Member
There was a problem hiding this comment.
I suggest using textwrap.dedent to preserve the indentation, even though the other tests in this file don't do so:
test_script = textwrap.dedent(f'''
import multiprocess
....
''')
aisk
reviewed
Feb 12, 2026
| @@ -0,0 +1,2 @@ | |||
| Fix pickling error in the cProfile module when using ``multiprocessing.Process`` | |||
Member
There was a problem hiding this comment.
Suggested change
| Fix pickling error in the cProfile module when using ``multiprocessing.Process`` | |
| Fix pickling error in the :mode:`cProfile` module when using :class:`multiprocessing.Process` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When profilng the ttt.py script via
cProfilemodule ,an error occurs:
This fix does not apply to the
profilemodule, which is deprecated and will be removed in python 3.17.